<template>
    <el-menu default-active="0" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose">
        <el-menu-item :index="`${index}`" v-for="(item, index) in routes[0]?.children" :key="item.path" @click="handleClick(item)">
            <el-icon><icon-menu /></el-icon>
            <span>{{ item.menu }}</span>
        </el-menu-item>
    </el-menu>
</template>

<script setup lang="ts">
import { Menu as IconMenu, } from '@element-plus/icons-vue'
import { routes } from '@/router'
import { useRouter } from 'vue-router'

const router = useRouter()
const emits=defineEmits(['select'])

const handleOpen = (key: string, keyPath: string[]) => {
    
}
const handleClose = (key: string, keyPath: string[]) => {
   
}
const handleClick = (item:any) => {
    emits('select',item.menu)
    router.push(item)
}
</script>

<style lang="scss" scoped></style>
